package com.byb.server.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springframework.data.elasticsearch.annotations.Document;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;

/**
 * 其他保障详情
 */
@ApiModel(description = "其他保障详情")
@Entity
@Table(name = "other_safeguard_2nd")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Document(indexName = "othersafeguard2nd")
public class OtherSafeguard2nd implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 其他保障名称
     */
    @ApiModelProperty(value = "其他保障名称")
    @Column(name = "title")
    private String title;

    /**
     * 简述
     */
    @ApiModelProperty(value = "简述")
    @Column(name = "info")
    private String info;

    /**
     * 保障介绍图片
     */
    @ApiModelProperty(value = "保障介绍图片")
    @Column(name = "safe_img")
    private String safeImg;

    @ManyToOne
    private OtherSafeguard otherSafeguard;

    @ManyToOne
    @JsonIgnore
    private Product product;

    // jhipster-needle-entity-add-field - Jhipster will add fields here, do not remove
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public OtherSafeguard2nd title(String title) {
        this.title = title;
        return this;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getInfo() {
        return info;
    }

    public OtherSafeguard2nd info(String info) {
        this.info = info;
        return this;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    public String getSafeImg() {
        return safeImg;
    }

    public OtherSafeguard2nd safeImg(String safeImg) {
        this.safeImg = safeImg;
        return this;
    }

    public void setSafeImg(String safeImg) {
        this.safeImg = safeImg;
    }

    public OtherSafeguard getOtherSafeguard() {
        return otherSafeguard;
    }

    public OtherSafeguard2nd otherSafeguard(OtherSafeguard otherSafeguard) {
        this.otherSafeguard = otherSafeguard;
        return this;
    }

    public void setOtherSafeguard(OtherSafeguard otherSafeguard) {
        this.otherSafeguard = otherSafeguard;
    }

    public Product getProduct() {
        return product;
    }

    public OtherSafeguard2nd product(Product product) {
        this.product = product;
        return this;
    }

    public void setProduct(Product product) {
        this.product = product;
    }
    // jhipster-needle-entity-add-getters-setters - Jhipster will add getters and setters here, do not remove

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        OtherSafeguard2nd otherSafeguard2nd = (OtherSafeguard2nd) o;
        if (otherSafeguard2nd.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), otherSafeguard2nd.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "OtherSafeguard2nd{" +
            "id=" + getId() +
            ", title='" + getTitle() + "'" +
            ", info='" + getInfo() + "'" +
            ", safeImg='" + getSafeImg() + "'" +
            "}";
    }
}
